/* 项目的入口文件 */

//引入createApp工厂函数
import { createApp } from 'vue';

// 引入App组件，它是所有组件的父组件
import App from '@admin/App.vue';

// 引入样式文件
import './assets/css/global.css';
import './assets/fonts/iconfont.css';

// 创建Vue实例对象，并且关在App组件到容器
const app = createApp(App);
// 1：通过暴露和注入的方式挂载全局$http属性
import Http from '@admin/http/index.js';
app.provide('$http', Http);
// 组件中使用$http
// import {inject} from 'vue'
// let http = inject('$http');

// 2：引入路由器
import router from '@admin/router/index.js';
// 使用路由器
app.use(router);
//图标 图标在附件中
import './assets/icon/iconfont.css'
import './assets/base.scss'
// 3：完整引入ElementPlus

//自定义组件
import Icon from "@/components/Icon.vue"
import Dialog from '@/components/Dialog.vue'
import NoData from '@/components/NoData.vue'
import Window from '@/components/Window.vue'

import Navigation from '@/components/Navigation.vue'
import FolderSelect from '@/components/FolderSelect.vue'
import Avatar from '@/components/Avatar.vue'
import ElementPlus from 'element-plus';
import 'element-plus/dist/index.css';
app.component("Dialog", Dialog);
app.component("NoData", NoData);
app.component("Window", Window);

app.component("Navigation", Navigation);
app.component("FolderSelect", FolderSelect);
app.component("Avatar", Avatar);
app.component("Icon", Icon);
// 导入所有图标并进行全局注册。
import * as ElementPlusIconsVue from '@element-plus/icons-vue';
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}
// 默认使用英语
import zhCn from 'element-plus/es/locale/lang/zh-cn';
app.use(ElementPlus, {
  locale: zhCn,
});

// 4: 挂载Message组件
import { ElMessage } from 'element-plus';
app.provide('$message', ElMessage);

import { ElMessageBox } from 'element-plus';
app.provide('$confirm', ElMessageBox.confirm);


//挂载
app.mount('#app');
